#import "OmRegisterVCSexChooseView.h"
@interface OmRegisterVCSexChooseView ()
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) OmBaseButton *femaleButton;
@property (nonatomic, strong) OmBaseButton *maleButton;
@property (nonatomic, strong) UIView *line;
@end
@implementation OmRegisterVCSexChooseView
- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self configSelf];
        [self allocateComponent];
        [self layoutComponent];
    }
    return self;
}
- (void)configSelf {
    [self mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.equalTo(@(WINDOW_WIDTH));
        make.height.equalTo(@(RPX(65)));
    }];
}
- (void)allocateComponent {
    self.titleLabel = [[UILabel alloc] init].fp_text(ASLocalizedString(@"请选择性别")).fp_textColor([UIColor blackColor]).fp_font(RPXFont(15));
    [self addSubview:self.titleLabel];
    self.femaleButton = [[OmBaseButton alloc] initAutoWidthHorizontalButtonWithImageName:@"OmDeselect"
                                                                               imageSize:CGSizeMake(RPX(21), RPX(21))
                                                                                   title:ASLocalizedString(@"女")
                                                                               titleFont:RPXFont(15)
                                                                              titleColor:[UIColor blackColor]
                                                                                distance:RPX(11)
                                                                            isImageRight:NO];
    [self.femaleButton addTarget:self action:@selector(onFemaleButtonTap) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:self.femaleButton];
    self.maleButton = [[OmBaseButton alloc] initAutoWidthHorizontalButtonWithImageName:@"OmDeselect"
                                                                               imageSize:CGSizeMake(RPX(21), RPX(21))
                                                                                   title:ASLocalizedString(@"男")
                                                                               titleFont:RPXFont(15)
                                                                              titleColor:[UIColor blackColor]
                                                                                distance:RPX(11)
                                                                            isImageRight:NO];
    [self.maleButton addTarget:self action:@selector(onMaleButtonTap) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:self.maleButton];
    self.line = [[UIView alloc] init].fp_backgroundColor(HexadecimalColor(@"#F07896"));
    [self addSubview:self.line];
}
- (void)layoutComponent {
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self);
        make.left.equalTo(self).offset(RPX(30));
    }];
    [self.femaleButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self);
        make.right.equalTo(self).offset(RPX(-157));
        make.height.equalTo(@(RPX(21)));
    }];
    [self.maleButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self);
        make.right.equalTo(self).offset(RPX(-30));
        make.height.equalTo(@(RPX(21)));
    }];
    [self.line mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.equalTo(@(RPX(345)));
        make.height.equalTo(@(1));
        make.centerX.equalTo(self);
        make.bottom.equalTo(self);
    }];
}
- (void)onFemaleButtonTap {
    [self.femaleButton.coolImageView setImage:IMAGE_NAMED(@"OmSelect")];
    [self.maleButton.coolImageView setImage:IMAGE_NAMED(@"OmDeselect")];
    self.sex = @"2";
}
- (void)onMaleButtonTap {
    [self.maleButton.coolImageView setImage:IMAGE_NAMED(@"OmSelect")];
    [self.femaleButton.coolImageView setImage:IMAGE_NAMED(@"OmDeselect")];
    self.sex = @"1";
}
@end
